package com.github.zzay.user.feign.factory;

import com.github.zzay.user.feign.UserServiceClient;
import com.github.zzay.user.feign.fallback.UserServiceClientFallbackImpl;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author zzay
 * @className UserServiceClientFallbackFactory
 * @description User Service Client Fallback Factory
 * @create 2022/06/06 15:11
 * @see UserServiceClientFallbackImpl
 */
@Component
public class UserServiceClientFallbackFactory implements FallbackFactory<UserServiceClient> {

    @Override
    public UserServiceClient create(Throwable cause) {
        UserServiceClientFallbackImpl userServiceClientFallback = new UserServiceClientFallbackImpl();
        userServiceClientFallback.setThrowable(cause);
        return userServiceClientFallback;
    }

}
